package com.tanhua.server.controller;

import com.tanhua.server.service.VoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * wzp 2021/6/23 10:20
 */
@RestController
@RequestMapping("peachblossom")
public class VoiceController {

    @Autowired
    private VoiceService voiceService;

    /**
     * 接口名称：桃花传音-发送语音（学生实战）
     * 接口路径：POST/peachblossom
     */
    @PostMapping
    public ResponseEntity<Object> sendVoice(@RequestBody MultipartFile soundFile) throws IOException {
        return voiceService.sendVoice(soundFile);
    }

    /**
     * 接口名称：桃花传音-接收语音（学生实战）
     * 接口路径：GET/peachblossom
     */
    @GetMapping
    public ResponseEntity<Object> getVoice(){
        return voiceService.getVoice();
    }

}
